using Perfect.Marshal;
using System.Xml;

namespace editor
{
namespace cfg.task
{
[System.Serializable]
public  class NoPic : NodeArrange
 {

    public string desc  = "";
     public string decoration  = "";
     public string goalDesc  = "";
     public System.Collections.Generic.List<string> stepDescList  = new System.Collections.Generic.List<string>();
     public int needTaskId ;
     


    public const int TYPE_ID = 857750026;

    public override int GetTypeId() {
        return TYPE_ID;
    }


    public override void MarshalCompatible(Perfect.Marshal.Octets os) {
        os.WriteSize(7);
        os.WriteSize(Tag.STRING | (1 << Tag.TAG_SHIFT));  os.WriteString(title);  
         os.WriteSize(Tag.BEAN | (2 << Tag.TAG_SHIFT));  { var _oldOs = os; os = new Perfect.Marshal.Octets(); cfg.Extensions.marshal_compatible_cfg_map_Vector2(position,os);  _oldOs.WriteOctets(os); os = _oldOs;}  
         os.WriteSize(Tag.STRING | (3 << Tag.TAG_SHIFT));  os.WriteString(desc);  
         os.WriteSize(Tag.STRING | (4 << Tag.TAG_SHIFT));  os.WriteString(decoration);  
         os.WriteSize(Tag.STRING | (5 << Tag.TAG_SHIFT));  os.WriteString(goalDesc);  
         os.WriteSize(Tag.LIST | (6 << Tag.TAG_SHIFT));  { var _oldOs = os; os = new Perfect.Marshal.Octets(); cfg.Extensions.marshal_compatible_list_string(stepDescList,os);  _oldOs.WriteOctets(os); os = _oldOs;}  
         os.WriteSize(Tag.INT | (7 << Tag.TAG_SHIFT));  os.WriteInt(needTaskId);  
         
    }

    public override void UnmarshalCompatible(Perfect.Marshal.Octets os) {
        for (int _var_num_ = os.ReadSize(); _var_num_-- > 0; ) {
            int _id_ = os.ReadSize();
            switch (_id_)
            {
            case (Tag.STRING | (1 << Tag.TAG_SHIFT)):   title = os.ReadString(); break;  
             case (Tag.BEAN | (2 << Tag.TAG_SHIFT)):  { var _oldOs = os; os = os.ReadOctets(); position = cfg.Extensions.unmarshal_compatible_cfg_map_Vector2(os); os = _oldOs; break; }   
             case (Tag.STRING | (3 << Tag.TAG_SHIFT)):   desc = os.ReadString(); break;  
             case (Tag.STRING | (4 << Tag.TAG_SHIFT)):   decoration = os.ReadString(); break;  
             case (Tag.STRING | (5 << Tag.TAG_SHIFT)):   goalDesc = os.ReadString(); break;  
             case (Tag.LIST | (6 << Tag.TAG_SHIFT)):  { var _oldOs = os; os = os.ReadOctets(); stepDescList = cfg.Extensions.unmarshal_compatible_list_string(os); os = _oldOs; break; }   
             case (Tag.INT | (7 << Tag.TAG_SHIFT)):   needTaskId = os.ReadInt(); break;  
             
            default: Tag.SkipUnknownField(_id_, os); break;
            }
         }
    }
    public override void MarshalXml(XmlWriter ele)
    {
        ele.WriteAttributeString("type", "NoPic");
        ele.WriteStartElement("title"); ele.WriteAttributeString("id", "1"); ele.WriteString2(title); ele.WriteEndElement();
         ele.WriteStartElement("position"); ele.WriteAttributeString("id", "2"); cfg.Extensions.xml_marshal_cfg_map_Vector2(position,ele); ele.WriteEndElement();
         ele.WriteStartElement("desc"); ele.WriteAttributeString("id", "3"); ele.WriteString2(desc); ele.WriteEndElement();
         ele.WriteStartElement("decoration"); ele.WriteAttributeString("id", "4"); ele.WriteString2(decoration); ele.WriteEndElement();
         ele.WriteStartElement("goalDesc"); ele.WriteAttributeString("id", "5"); ele.WriteString2(goalDesc); ele.WriteEndElement();
         ele.WriteStartElement("stepDescList"); ele.WriteAttributeString("id", "6"); cfg.Extensions.xml_marshal_list_string(stepDescList,ele); ele.WriteEndElement();
         ele.WriteStartElement("needTaskId"); ele.WriteAttributeString("id", "7"); ele.WriteInt(needTaskId); ele.WriteEndElement();
         
    }

    public override void UnmarshalXml(XmlElement ele)
    {
        foreach (XmlElement e in ele.GetChildren())
        {
            if (int.TryParse(ele.GetAttribute("id"), out var _id_))
            {
                switch (_id_)
                {
                case 1:  title = ele.ReadString2(); break; 
                 case 2:  position = cfg.Extensions.xml_unmarshal_cfg_map_Vector2(ele); break; 
                 case 3:  desc = ele.ReadString2(); break; 
                 case 4:  decoration = ele.ReadString2(); break; 
                 case 5:  goalDesc = ele.ReadString2(); break; 
                 case 6:  stepDescList = cfg.Extensions.xml_unmarshal_list_string(ele); break; 
                 case 7:  needTaskId = ele.ReadInt(); break; 
                 
                default: break;
                }
            }
            else
            {
                switch (e.Name)
                {
                case "title":  title = ele.ReadString2(); break; 
                 case "position":  position = cfg.Extensions.xml_unmarshal_cfg_map_Vector2(ele); break; 
                 case "desc":  desc = ele.ReadString2(); break; 
                 case "decoration":  decoration = ele.ReadString2(); break; 
                 case "goal_desc":  goalDesc = ele.ReadString2(); break; 
                 case "step_desc_list":  stepDescList = cfg.Extensions.xml_unmarshal_list_string(ele); break; 
                 case "need_task_id":  needTaskId = ele.ReadInt(); break; 
                 
                default: break;
                }
            }
        }
    }
}
}
}
